using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace QuickLaunch
{
    public partial class SettingForm : Form
    {
        private DirSettingControl tabControl1;
        private ShortcutSettingControl tabControl2;

        public SettingForm()
        {
            InitializeComponent();

            // initialize the tab pages.
            this.tabControl1 = new DirSettingControl();
            tabControl1.Dock = DockStyle.Fill;
            tabControl1.SettingChanged += new SettingChangedEventHandler(tabControl_SettingChanged);
            this.tab_Directories.Controls.Add(tabControl1);
            
            this.tabControl2 = new ShortcutSettingControl();
            tabControl2.Dock = DockStyle.Fill;
            tabControl2.SettingChanged +=new SettingChangedEventHandler(tabControl_SettingChanged);
            this.tab_Shortcuts.Controls.Add(tabControl2);
        }
      
        void tabControl_SettingChanged(object sender, SettingChangedEventArgs e)
        {
            // when changes occur, enable the 'apply' button.
            this.btn_Apply.Enabled = true;
        }

        private void btn_SaveSetting_Click(object sender, EventArgs e)
        {
            this.btn_Apply_Click(null, null);

            this.Close();
        }

        private void btn_Apply_Click(object sender, EventArgs e)
        {
            this.tabControl1.SaveChanges();
            this.tabControl2.SaveChanges();

            this.btn_Apply.Enabled = false;
        }

        private void btn_Cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}